#include "test_thread.h"
#include <thread>
#include <QDebug>
#include <QDateTime>

test_thread::test_thread() {}

void f(char a[])
{
    for (int i = 0; i < 100; ++i) {
        qDebug() << a << "i = " << i;
    }
}

void test_thread::test()
{
    char a[] = "aaa";
    char b[] = "bbb";
    std::thread td(f,a);
    std::thread td1(f,b);

    td.join();


    for (int i = 0; i < 100; ++i) {
        qDebug() << "main i = " << i;
    }
    qDebug() << "sleep1" << QDateTime::currentDateTime();
    std::this_thread::sleep_for(std::chrono::seconds(2));
    qDebug() << "sleep" << QDateTime::currentDateTime();
}
